﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Test {
    public partial class Form1 : Form {
        private List<string> keyword = new List<string>(); 
        private object locker = new object();
        public Form1() {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e) {
            OpenFileDialog dialog = new OpenFileDialog();
            if (dialog.ShowDialog() == DialogResult.OK) {
                TextBox7.Text = dialog.FileName;
                System.IO.StreamReader file =
   new System.IO.StreamReader("c:\\test.txt");
                string line;
                keyword.Clear();
                lock (locker) {
                    while ((line = file.ReadLine()) != null) {
                        keyword.Add(line);
                    }    
                }
                

                file.Close();
            }
        }
        private void Start() {
            
            using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"./output.txt", true)) {
                file.WriteLine("Fourth line");
            }
        }
    }
}
